#include <stdlib.h>
#include <stdio.h>

#include "dtk.h"

int test()
{
	DTKActor *stage, *scene;
	DTKActor *box1, *box2, *box3;
	DTKButton* button1, *button2;
	DTKTexture* texture;
	DTKText* text;

	DColor bgcolor = {0xff, 0xff, 0xff, 0xff};

	stage = dtk_stage_new(NULL);
	dtk_actor_set_size(stage, 480, 272);
	dtk_actor_set_bgcolor (stage, &bgcolor);

	scene = dtk_scene_new();
	dtk_actor_set_size(scene, 400, 272);
	dtk_actor_set_position (scene, 80, 0);
	dtk_actor_set_margin(scene, 10, 10, 10, 10);
	bgcolor.red = 0;
	dtk_actor_set_bgcolor (scene, &bgcolor);
	dtk_actor_add(stage, scene, NULL);

	box1 = dtk_box_new();
	bgcolor.red = 0;
	bgcolor.green = 0;
	bgcolor.blue = 0;
	dtk_actor_set_bgcolor(box1, &bgcolor);

	dtk_actor_add (scene, box1, NULL);

	box2 = dtk_box_new();
	dtk_box_set_orientation (box2, DTK_HORIZONTAL);
	bgcolor.red = 0xff;
	bgcolor.green = 0x33;
	bgcolor.blue = 0x47;
	bgcolor.alpha = 0xff;
	dtk_actor_set_bgcolor(box2, &bgcolor);

	dtk_actor_set_margin(box2, 8, 8, 8, 8);

	text = dtk_text_new_with_text ("vera.ttf", "text test2", 34);
	dtk_actor_set_size (text, 80, 100);
	bgcolor.red = 0xff;
	bgcolor.green = 0xff;
	bgcolor.blue = 0xff;
	bgcolor.alpha = 0xe0;
	dtk_text_set_color (text, &bgcolor);
	dtk_text_set_line_mode (text, DTK_FALSE);

	texture = dtk_texture_new_from_file ("texture.png");
	dtk_actor_set_size (texture, 50, 100);
	dtk_actor_add(box2, text, texture, NULL);


	box3 = dtk_box_new();
	dtk_box_set_orientation (box3, DTK_HORIZONTAL);
	bgcolor.red = 0x45;
	bgcolor.green = 0x33;
	bgcolor.blue = 0xe7;
	bgcolor.alpha = 0xff;
	dtk_actor_set_bgcolor(box3, &bgcolor);
	dtk_actor_set_margin(box3, 8, 8, 8, 8);

	button1 = dtk_button_new ("test1");
	dtk_actor_set_margin(button1, 8, 8, 8, 8);
	dtk_actor_set_size (button1, 120, 50);
	dtk_actor_add(box3, button1, NULL);

	dtk_actor_add(box1, box2, box3, NULL);


	dtk_actor_show_all(stage);
}

int main(int argc, char* argv[])
{
	dtk_init (&argc, &argv);

	test();
	dtk_loop();
	dtk_release();
	return 0;

}
